package com.ccys.cms.controller.userManagement;

import com.ccys.cms.service.userManagement.DoctorAcronymsService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.userManagement.DoctorAcronymsDto;
import com.ccys.db.vo.userManagement.DoctorAcronymsPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @program: WhiteCoat
 * @description: 医生短语设置接口
 * @author: ZhangJingCan
 * @create: 2023-12-20 09:30
 **/

@RestController
@RequestMapping("userManagement")
@Api(tags = "userManagement-医生短语设置接口")
public class DoctorAcronymsController {

    @Autowired
    private DoctorAcronymsService doctorAcronymsService;



    @PostMapping("doctorAcronyms")
    @ApiOperation("保存医生短语设置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "groupId", value = "国家ID", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "acronym", value = "缩写", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "phrase", value = "短语", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "dispOrder", value = "序号", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveDoctorAcronyms(@ApiIgnore DoctorAcronymsDto dto) {
        return doctorAcronymsService.saveDoctorAcronyms(dto);
    }

    @PutMapping("doctorAcronyms")
    @ApiOperation("修改医生短语设置")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "groupId", value = "国家ID", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "acronym", value = "缩写", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "phrase", value = "短语", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "dispOrder", value = "序号", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult editDoctorAcronyms(@ApiIgnore DoctorAcronymsDto dto) {
        return doctorAcronymsService.saveDoctorAcronyms(dto);
    }

    @DeleteMapping("doctorAcronyms")
    @ApiOperation("根据ID删除医生短语设置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult deleteDoctorAcronyms(@ApiIgnore DoctorAcronymsDto dto) {
        return doctorAcronymsService.deleteDoctorAcronyms(dto);
    }


    @GetMapping("doctorAcronyms")
    @ApiOperation("分页查询医生短语设置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "groupId", value = "国家ID/查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "acronym", value = "缩写/模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "0/1,查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "orderByStr",
                    value = "(默认传：t1.created_on descend),(左到右依次:t1.acronym,t3.group_name,t1.status,t2.user_fullname,t1.created_on)",
                    required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult<PageInfo<DoctorAcronymsPageQueryVo>, Object> findPageDoctorAcronyms(@ApiIgnore DoctorAcronymsDto dto) {
        return doctorAcronymsService.findPageDoctorAcronyms(dto);
    }


    @PutMapping("doctorAcronyms/status")
    @ApiOperation("根据ID修改医生短语设置状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态：0-禁用，1-启用", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateDoctorAcronymsStatus(@ApiIgnore DoctorAcronymsDto dto) {
        return doctorAcronymsService.updateDoctorAcronymsStatus(dto);
    }

}
